package com.zxc.questionservice.controller.inner;

import com.zxc.oj.model.entity.Question;
import com.zxc.oj.model.entity.QuestionSubmit;
import com.zxc.questionservice.service.QuestionService;
import com.zxc.questionservice.service.QuestionSubmitService;
import com.zxc.service.QuestionFeignClient;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/inner")
@RequiredArgsConstructor
public class QuestionInnerController implements QuestionFeignClient {

    private final QuestionService questionService;

    private final QuestionSubmitService questionSubmitService;

    @Override
    @GetMapping("/get/id")
    public Question getQuestionById(@RequestParam("questionId") long questionId) {
        return questionService.getById(questionId);

    }


    @Override
    @GetMapping("/question_submit/get/id")
    public QuestionSubmit getQuestionSubmitById(@RequestParam("questionSubmitId") long questionSubmitId) {

        return questionSubmitService.getById(questionSubmitId);
    }

    @Override
    @PostMapping("/question_submit/update")
    public boolean updateQuestionSubmitById(@RequestBody QuestionSubmit questionSubmit) {
        return questionSubmitService.updateById(questionSubmit);
    }
}
